<?php defined('_VALID_MOS') or die('Direct Access to this location is not allowed.'); ?>

<script language="javascript" type="text/javascript">
    function submitbutton(pressbutton) {
        var form = document.adminForm;
        if (pressbutton == 'cancel') {
            submitform( pressbutton );
            return;
        }
        if (form.player_name.value == ""){
            alert( "Player must have a name");
        }
        else {
            submitform( pressbutton );
        }
    }
</script>

<table cellpadding="4" cellspacing="0" border="0" width="100%">
    <tr>
        <td width="100%">
            <span class="sectionname">
                <?php echo $this->row->player_id ? 'Edit' : 'Add'; ?> <?php echo 'Player'; ?>
            </span>
        </td>
    </tr>
</table>

<form action="index2.php" method="post" name="adminForm" id="adminForm" enctype="multipart/form-data">

    <?php
        $ptabs = new mosTabs(0);
        $ptabs->startPane("com_leagueman");
        $ptabs->startTab("General", "General-page");
    ?>

        <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
            <tr>
                <td width="60%" valign="top">
                    <table width="100%">
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Displayname'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_name" size="20" class="text_area" value="<?php echo $this->row->getName(); ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Firstname'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_name_first" size="20" class="text_area" value="<?php echo $this->row->getFirstname(); ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Lastname'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_name_last" size="20" class="text_area" value="<?php echo $this->row->getLastname(); ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Born'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_born" size="20" class="text_area" value="<?php echo $this->row->getBirthday(); ?>" />&nbsp;&nbsp; (yyyy-mm-dd)
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Died'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_died" size="20" class="text_area" value="<?php echo $this->row->getDeathday(); ?>" />&nbsp;&nbsp; (yyyy-mm-dd)
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Weight (in kg)'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_weight" size="20" class="text_area" value="<?php echo $this->row->getWeight(); ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Height (in cm)'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_height" size="20" class="text_area" value="<?php echo $this->row->getHeight(); ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Country'; ?></b></td>
                            <td width="80%">
                                <input type="text" name="player_country" size="20" class="text_area" value="<?php echo $this->row->getCountry(); ?>" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Image'; ?></b></td>
                            <td width="80%">
                                <input type="file" name="upload" size="40" class="text_area" />
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Is Referee'; ?></b></td>
                            <td width="80%">
                                <?php echo mosHTML::yesnoRadioList('player_is_referee', '', $this->row->player_is_referee); ?>
                            </td>
                        </tr>
                        <tr>
                            <td width="20%" align="right"><b><?php echo 'Is Trainer'; ?></b></td>
                            <td width="80%">
                                <?php echo mosHTML::yesnoRadioList('player_is_trainer', '', $this->row->player_is_trainer); ?>
                            </td>
                        </tr>
                    </table>
                </td>
                <td width="40%" valign="middle">
                    <div align="center">
                        <?php $this->plugin("thumb", "players", $this->row->getImage(), 200, 0, 'width="200"'); ?>
                    </div>
                </td>
            </tr>
        </table>
    <?php
        $ptabs->endTab();
        $ptabs->startTab("Description", "Description-page");
    ?>
        <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
            <tr>
                <td width="80%">
                    <textarea name="player_text" rows="15" cols="100" class="text_area"><?php echo $this->row->getText(); ?></textarea>
                </td>
            </tr>
        </table>

    <?php
        $ptabs->endTab();
        $ptabs->startTab("History", "History-page");
    ?>
        <table cellpadding="4" cellspacing="1" border="0" width="100%" class="adminform">
            <tr>
                <td>
                    <?php $this->plugin("leagueman_get_player_adminstat", $this->row); ?>
                </td>
            </tr>
        </table>
    <?php
        $ptabs->endTab();
        $ptabs->endPane();
    ?>

    <input type="hidden" name="player_id" value="<?php echo $this->row->getID(); ?>" />
    <input type="hidden" name="option" value="com_leagueman" />
    <input type="hidden" name="act" value="players" />
    <input type="hidden" name="task" value="" />
</form>